﻿using System;
using System.Collections.Generic;
using System.Data;
using br.com.SistemaChamados.Enum;
using br.com.SistemaChamados.Model;
using br.com.SistemaChamados.QueryManager.Core;
using br.com.SistemaChamados.QueryManager.Core.Behavior;

namespace br.com.SistemaChamados.DAO
{
    public class CallStatusDAO : GenericDao<CallStatus>
    {
        private static string SQL_INSERT_CALLSTATUS = " INSERT INTO TBL_CALLSTATUS (TBL_CALLSTATUSDESCRIPTION) VALUES (@callstatusdescription) ";
        private static string SQL_GET_CALLSTATUS = " SELECT * FROM TBL_CALLSTATUS";

        public static List<CallStatus> GetCallStatus()
        {
            List<CallStatus> listStatus = new List<CallStatus>();
            try
            {
                listStatus = QueryManagerPerformer.Select(typeof(CallStatus), ConnectionBehavior.CONNECTION_BEHAVIOR_CLOSE_AFTER_OPERATION)
                                .ConvertAll(convertObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listStatus;
        }

        public EnumCRUDState InsertCallStatus(CallStatus callStatus)
        {
            EnumCRUDState resultCallStatus = EnumCRUDState.SQL_NOTHING;
            try
            {
                QueryManagerPerformer.Insert(callStatus, new string[] { "Id" }, ConnectionBehavior.CONNECTION_BEHAVIOR_CLOSE_AFTER_OPERATION);
                resultCallStatus = EnumCRUDState.SQL_SUCCESS;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return resultCallStatus;
        }
    }
}